package com.shop2cn.iapi.shenqiriskcontrol.service;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;

import com.ymt.base.YmatouEasyCall;

public class CounterService {

	public static void setUserPaidAmountSum(String targetId, Integer value,
			String dataTime) throws ClientProtocolException, IOException {

		YmatouEasyCall setAmountCall = new YmatouEasyCall("", "POST", "JSON");
		StringBuilder setAmountString = new StringBuilder();

		setAmountString.append("{\"targetId\":\""
				+ targetId + "\",");
		setAmountString.append("\"appId\":\"shenqiriskcontrol\", \"counter\":\"UserPaidAmountSum\",");
		setAmountString.append("\"value\":" + value + ",");
		setAmountString.append("\"DataTime\":\"" + dataTime + "\",");
		setAmountString.append("\"Action\":1}");

		setAmountCall
				.setUrl("http://counter.iapi.ymatou.com/api/set/natural");

		setAmountCall.setData(setAmountString.toString());
		setAmountCall.callService();
	}
	
	public static void setUserPaidCounter(String targetId, Integer value,
			String dataTime) throws ClientProtocolException, IOException {

		YmatouEasyCall setAmountCall = new YmatouEasyCall("", "POST", "JSON");
		StringBuilder setAmountString = new StringBuilder();

		setAmountString.append("{\"targetId\":\""
				+ targetId + "\",");
		setAmountString.append("\"appId\":\"shenqiriskcontrol\", \"counter\":\"UserPaidCounter\",");
		setAmountString.append("\"value\":" + value + ",");
		setAmountString.append("\"DataTime\":\"" + dataTime + "\",");
		setAmountString.append("\"Action\":1}");

		setAmountCall
				.setUrl("http://counter.iapi.ymatou.com/api/set/natural");

		setAmountCall.setData(setAmountString.toString());
		setAmountCall.callService();
	}
}